Hi,
Is there a way to loop through all the items in a TreeView?
Is there a way to loop through all the items below a given TreeView Node?
Is there a way to loop through just the child items of a given TreeView Node?
I can't see a way to 'get' the TreeView item count or a TreeView item path by index like with a ListView.
Hoping I don't need to maintain an additional Skip of items...
Thanks
SystemAdmin - Tue Sep 27 12:28:08 EDT 2011 |
|
Re: Loop TreeView Items Mathias Mamsch - Tue Sep 27 13:32:39 EDT 2011
You can only deal in one way with treeviews. You can iterate over all treeview entries and get their paths:
int cnt = 0; string s; for s in dbeTreeview do { print (cnt++) ": " s "\n" }
Treeviews separate their items by slashes (therefore you cannot add items with slashes in a treeview). From that it is pretty clear how to answer the rest of the questions. To find the child nodes you search for items that start with the same path. To find items below you will search for all items that come after the respective item. Well and to count the items you probably need to count them.
If performance is an issue I would suggest to write a library with an ExtendedTreeview, which will store the meta information for you and provide additional information functions.
Hope that helps, Regards, Mathias
Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS
|
|
Re: Loop TreeView Items SystemAdmin - Wed Sep 28 04:27:40 EDT 2011 Mathias Mamsch - Tue Sep 27 13:32:39 EDT 2011
You can only deal in one way with treeviews. You can iterate over all treeview entries and get their paths:
int cnt = 0; string s; for s in dbeTreeview do { print (cnt++) ": " s "\n" }
Treeviews separate their items by slashes (therefore you cannot add items with slashes in a treeview). From that it is pretty clear how to answer the rest of the questions. To find the child nodes you search for items that start with the same path. To find items below you will search for all items that come after the respective item. Well and to count the items you probably need to count them.
If performance is an issue I would suggest to write a library with an ExtendedTreeview, which will store the meta information for you and provide additional information functions.
Hope that helps, Regards, Mathias
Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS
Thanks, I don't see that for loop in the help (no surprise there though) and when I try it I get the error:
"DBE is neither a list nor a listView"
Maybe it's a my DOORS version. I am using DOORS 9.3.0.2
|
|
Re: Loop TreeView Items SystemAdmin - Wed Sep 28 04:28:10 EDT 2011 Mathias Mamsch - Tue Sep 27 13:32:39 EDT 2011
You can only deal in one way with treeviews. You can iterate over all treeview entries and get their paths:
int cnt = 0; string s; for s in dbeTreeview do { print (cnt++) ": " s "\n" }
Treeviews separate their items by slashes (therefore you cannot add items with slashes in a treeview). From that it is pretty clear how to answer the rest of the questions. To find the child nodes you search for items that start with the same path. To find items below you will search for all items that come after the respective item. Well and to count the items you probably need to count them.
If performance is an issue I would suggest to write a library with an ExtendedTreeview, which will store the meta information for you and provide additional information functions.
Hope that helps, Regards, Mathias
Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS
Thanks, I don't see that for loop in the help (no surprise there though) and when I try it I get the error:
"DBE is neither a list nor a listView"
Maybe it's a my DOORS version. I am using DOORS 9.3.0.2
|
|
Re: Loop TreeView Items Mathias Mamsch - Wed Sep 28 06:52:46 EDT 2011 SystemAdmin - Wed Sep 28 04:28:10 EDT 2011
Thanks, I don't see that for loop in the help (no surprise there though) and when I try it I get the error:
"DBE is neither a list nor a listView"
Maybe it's a my DOORS version. I am using DOORS 9.3.0.2
Ouch! Mental note: always double check what you are saying ;-) It seems you really cannot iterate over the items in the treeview and you indeed need to keep the item path in a skip list. Sorry for that. Regards, Mathias
Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS
|
|
Re: Loop TreeView Items SystemAdmin - Wed Sep 28 06:56:58 EDT 2011 Mathias Mamsch - Wed Sep 28 06:52:46 EDT 2011
Ouch! Mental note: always double check what you are saying ;-) It seems you really cannot iterate over the items in the treeview and you indeed need to keep the item path in a skip list. Sorry for that. Regards, Mathias
Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS
OK, that's what I feared.
Thanks again
|
|